<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="/css/common.css" />
		<link rel="stylesheet" type="text/css" href="/bootstrap-3.3.7/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/css/flatpickr.min.css" />
		<link rel="stylesheet" type="text/css" href="/css/font-awesome.css"/>
		<link rel="stylesheet" type="text/css" href="/dialog/css/dialog.css"/>
		<link rel="stylesheet" href="/css/shoufengqin.css">
		<link rel="stylesheet" type="text/css" href="/css/haha.css" media="screen" />


		<#--<script src="/js/jquery-1.9.1.min.js" type="text/javascript" ></script>
		<script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/dialog/js/dialog.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.form.js"></script>
		<script src="/js/common.js"></script>
		<script src="/js/flatpickr.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/shoufengqin.js"></script>
		<script src="/laydate/laydate.js"></script> --><!-- 改成你的路径 -->
        <script type="text/javascript">
            $().ready(function(){
                $("#addform").validate({
                    rules:{
                        compname:"required",
                    },
                    message:{
                        compname:"此项必填",
                    }
                });
                // if(document.getElementsByName(compcode)[0].values()==null){
                 //    alert("请选择公司类型");
                 //    return false;
				// }
            });
            function checkAmount() {

                //alert("hi1");
                /*                if($('#amountId').val()<=0){
                                    alert("入库数量必须为正整数");
                                    $('#amountId').val(null);
                                    // $('#amountId').focus();
                                    return;
                                }*/
                var re = /^[1-9][0-9]*$/ ;
                var s=$('#amountId').val();
                if(!re.test(s)){
                    alert("入库数量必须为正整数");
                    $('#amountId').val(null);
                    return;
                }
                //$('#amountId').focus();
                // var amount=$('#amountId').val();
                // alert(amount);
                // if(amount<=0){
                //     alert("必须为正整数");
                // }
            }
            function checkPrice() {
                //$('#priceId').focus();
                if($('#priceId').val()<=0){
                    alert("单价必须为正数");
                    $('#priceId').val(null);
                    return;
                }
            }
            function checkRealtotal() {
                //$('#realtotalId').focus();
                if($('#realtotalId').val()<=0){
                    alert("总价必须为正数");
                    $('#realtotalId').val(null);
                    return;
                }
            }
        </script>

	</head>

	<body>
		<!--顶部导航 -->
        <nav class="topNavItemBox">
            <div id="ItemBox">
                <div class="title">智慧溯源系统</div>
                <div class="subtitle">肉品溯源管理</div>
                <div class="rightUserInfo">
                    <div class="commentAvatarDiv">
                        <img class="commentAvatarImage" src="/images/people.jpg">
                    </div>
                    <div class="userName">
					<#if Session.curEmployeeInfo??>
                        <a href="/admin/logout">${Session.curEmployeeInfo.emName}</a>
                    </#if>
                    </div>
                    <span class="glyphicon glyphicon-option-vertical userIcon" aria-hidden="true"></span>
                </div>
            </div>
        </nav>
		<div class="contain">
			<#include "leftPage.ftl">
		</div>
			<!-- 新增疫苗入库信息 -->
			<div id="middle1" class="page_main">
				<div id="middle2" class="page_content">
				<div class="add_title">
					<div class="second_title_main">疫苗入库管理</div>
					<div class="second_title_main_bread">   > </div>
                    <div class="second_title_main">修改疫苗入库信息</div>
				</div>
                    <form id="addform" action="update" method="post">
                        <ul>
                            <li><label class="labelBeforinput">疫苗种类</label>
                                <select id="selectId" name="vaccineid"  class="bigInputtext" style="width: 50%" onchange="change()">
                                    <option value>请选择疫苗类型信息</option>
									<#list list_vac as ymzl>
                                            <option value="${ymzl.vaccineid}" <#if vaccineInStore.vaccineid=ymzl.vaccineid>selected</#if>>疫苗名称:${ymzl.vaccinename}&nbsp;&nbsp;&nbsp;&nbsp;
                                                疫苗类型:${ymzl.vaccinetype}&nbsp;&nbsp;&nbsp;供应商:
											<#list list_com as com>
                                                <#if ymzl.manufactoryid=com.gid>${com.compname}</#if>
                                            </#list>
                                                &nbsp;&nbsp;&nbsp;&nbsp;当前库存量:${ymzl.numinstore}</option>
                                    </#list>
                                </select>
                            </li>
                            <li><label class="labelBeforinput">入库数量</label><input id='amountId' name="amount"  class="bigInputtext" required type="text" value="${vaccineInStore.amount}" onblur="checkAmount()">*(入库数量请输入正整数)</li>
                            <input hidden="true" name="oldInStoreNum"  class="bigInputtext" required type="text" value="${vaccineInStore.amount}">
                            <li><label class="labelBeforinput">单价</label><input id='priceId' name="price"  class="bigInputtext" required type="text"  value="${vaccineInStore.price?string("0.##")}" onblur="checkPrice()">*(只保留到小数点后两位)</li>
                            <li><label class="labelBeforinput">总价</label><input id='realtotalId' name="realtotal"  class="bigInputtext" required type="text"  value="${vaccineInStore.realtotal?string("0.##")}" onblur="checkRealtotal()">*(只保留到小数点后两位)</li>
                            <li><label class="labelBeforinput">生产日期</label><input type="text" placeholder="请选择疫苗生产时间" id="product" name="producdate" class="bigInputtext" value="${vaccineInStore.producdate?string('yyyy-MM-dd')}" required></li>
                            <li><label class="labelBeforinput">过期日期</label><input type="text" placeholder="请选择疫苗过期时间" id="expire" name="expiredate" class="bigInputtext" value="${vaccineInStore.expiredate?string('yyyy-MM-dd')}" required></li>
                            <li><label class="labelBeforinput">入库人</label><input name="remark"  class="bigInputtext" required type="text"  value="${vaccineInStore.remark}" required>*</li>
                            <li><label class="labelBeforinput">入库日期</label><input type="text" placeholder="请选择疫苗入库时间" id="receive" name="receivedate" class="bigInputtext" value="${vaccineInStore.receivedate?string('yyyy-MM-dd')}" required></li>
                            <li><input type="submit" value="确认" style="margin-left:50px;width: 100px;background-color: #00BFFF;" /></li>
                            <input name="instoreid" value="${vaccineInStore.instoreid}"  type="text" hidden="true">
                        </ul>
                    </form>
				
				</div>
			</div>
		</div>
		<div class="footer">
				<div class="footer_lineone">
					<span id="logo"></span>肉品溯源管理系统 
					<span class="footer_lineoneSpan"><a href="aboutus.html">关于我们</a></span>
					<span class="footer_lineoneSpan"><a target="_blank" href="http://www.cfsiw.com/">食品安全信息</a></span> 
					<span class="footer_lineoneSpan"><a href="suggestionAdd.ftl">联系我们</a></span>
				</div>
				<div class="footer_linetwo">
					 &copy;2017广东技术师范学院
				</div>
			</div>
	</body>
    <script src="/js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/jquery.form.js"></script>
    <script src="/dialog/js/dialog.js"></script>
    <script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/common.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
    <script src="/laydate/laydate.js"></script> <!-- 改成你的路径 -->
    <script type="text/javascript" src="/js/b.page.js" ></script>
    <script src="/js/pager.js"></script>
    <script src="/js/shoufengqin.js"></script>
    <script src="/js/flatpickr.js"></script>
	<script type="text/javascript" charset="UTF-8">
		$(function() {
            //表单提交
            $("#addform").ajaxForm({
                success:function(data) {
                    var str = null;
                    var msg = null;
                    if(data.code == 0){
                        str = "success";
                        msg = "更新成功";
                        $.dialog({
                            type: 'info',
                            contentHtml: '<img class="info-icon" src="/dialog/images/icon/'+str+'.png" /><p class="info-text">'+msg+'</p>',
                            autoClose: 500
                        });
                        setTimeout('window.location.href="list"',1000);
                    }else{
                        str = "fail";
                        msg = "更新失败";
                        $.dialog({
                            type: 'info',
                            contentHtml: '<img class="info-icon" src="/dialog/images/icon/'+str+'.png" /><p class="info-text">'+msg+'</p>',
                            autoClose: 1000
                        });
                        setTimeout('window.location.href="list"',1000);
                    }

                }
            });

            //初始化侧边栏
            $(".vertical-nav").verticalnav({
                speed: 400,
                align: "left"
            });

            //时间选择组件1
            laydate.render({
                elem: '#product' //指定元素

            });

            //时间选择组件2
            laydate.render({
                elem: '#expire' //指定元素

            });

            //时间选择组件3
            laydate.render({
                elem: '#receive' //指定元素

            });

            jQuery(document).ready(function ($) {
                $('.list22 ul li p').clickdown();
                $('.list-se p[class=title22]').clickup();
                $('.list22>ul>li').ad();
            });
        });

        function change() {
            alert("疫苗种类信息不能修改");
            history.go(0) ;
        }
	</script>
</html>